
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
babel-plugin-transform-class-constructor-call
Advanced tools
This plugin allows Babel to transform class constructors (deprecated)
Proposal Withdrawn: can be solved with decorators.
This plugin allows Babel to transform class constructors.
It basically allows to use the new.target feature on ES2015 classes:
class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
call constructor(x, y) {
return new Point(x, y);
}
}
let p1 = new Point(1, 2); // OK
let p2 = Point(3, 4); // OK
The javascript Date works this way:
// You can get a Date instance using the new keyword
let now = new Date();
console.log(now.getMonth()); // Prints '3'
console.log(now.toString()); // Prints 'Mon Apr 11 2016 13:26:07 GMT+0100 (BST)'
// You can get a string of the current date using Date as a function:
let nowStr = Date();
console.log(nowStr); // Prints 'Mon Apr 11 2016 13:26:07 GMT+0100 (BST)'
It is currently possible to implement something like that using new.target (see example in proposal) and this new feature makes it available for ES2015 classes.
A date implementation could be:
class Date {
constructor() {
// ...
}
call constructor() {
let date = new Date();
return date.toString();
}
}
let now = new Date(); // Get a Date instance
let nowStr = Date(); // Use the 'call constructor()' part to get a string value of the current date
npm install --save-dev babel-plugin-transform-class-constructor-call
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-class-constructor-call"]
}
babel --plugins transform-class-constructor-call script.js
require("babel-core").transform("code", {
plugins: ["transform-class-constructor-call"]
});
FAQs
This plugin allows Babel to transform class constructors (deprecated)
We found that babel-plugin-transform-class-constructor-call demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.